package com.yjkf.zh.test.thread;

public class MyInterrupt {
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(()->{
            System.out.println("开始睡觉了");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("起来了");
        });
        thread.start(); //开启睡觉模式
        Thread.sleep(1000);
        if(!thread.isInterrupted()){

            System.out.println("我来打扰你睡觉了");
            thread.interrupt();
        }

    }
}
